#include "gltabwidget.h"
#include<QLabel>
#include<QToolButton>
#include<QVBoxLayout>
#include<QHBoxLayout>
#include<QPainter>
#include<QStyle>
#include<QStyleOption>


GLTabWidget::GLTabWidget(QWidget *parent)
    : QWidget{parent}
{
    this->gl_label=new QLabel("猜你喜欢",this);
    this->song_name_label=new QLabel("歌曲名称",this);
    this->play_toolButton=new QToolButton(this);
    this->next_toolButton=new QToolButton(this);
    this->like_toolButton=new QToolButton(this);
    this->dislike_toolButton=new QToolButton(this);

    this->setObjectName("basic_window_widget");
    this->gl_label->setObjectName("gl_label");
    this->song_name_label->setObjectName("song_name_label");
    this->play_toolButton->setObjectName("play_toolButton");
    this->next_toolButton->setObjectName("next_toolButton");
    this->like_toolButton->setObjectName("like_toolButton");
    this->dislike_toolButton->setObjectName("dislike_toolButton");



    layoutUI();


}

void GLTabWidget::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.initFrom(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

void GLTabWidget::layoutUI()
{
    QHBoxLayout* hLayout1=new QHBoxLayout();
    hLayout1->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Preferred,QSizePolicy::Preferred));
    hLayout1->addWidget(this->gl_label);
    hLayout1->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Expanding,QSizePolicy::Preferred));

    QHBoxLayout* hLayout2=new QHBoxLayout();
    hLayout2->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Preferred,QSizePolicy::Preferred));
    hLayout2->addWidget(this->song_name_label);
    hLayout2->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Expanding,QSizePolicy::Preferred));

    QHBoxLayout* hLayout3=new QHBoxLayout();
    hLayout3->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Preferred,QSizePolicy::Preferred));
    hLayout3->addWidget(this->play_toolButton);
    hLayout3->addWidget(this->next_toolButton);
    hLayout3->addWidget(this->like_toolButton);
    hLayout3->addWidget(this->dislike_toolButton);
    hLayout3->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Expanding,QSizePolicy::Preferred));


    QVBoxLayout* vLayout=new QVBoxLayout(this);
    vLayout->addSpacerItem(new QSpacerItem(40,20,QSizePolicy::Expanding));
    vLayout->addLayout(hLayout1);
    vLayout->addLayout(hLayout2);
    vLayout->addLayout(hLayout3);
    vLayout->addSpacerItem(new QSpacerItem(40,20,QSizePolicy::Expanding));
}
